package com.example.tao_city.text1;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

/**
 * Created by TAO_CITY on 2018/1/9.
 */

public class Fm4_Opinion extends AppCompatActivity {
    private ImageView back;
    private EditText text;
    private TextView number,phone;
    private Button button;
    @Override
    protected void onCreate(Bundle save){
        super.onCreate(save);
        setContentView(R.layout.opinion);
        initbutton();

    }
    private void initbutton(){
        back=findViewById(R.id.opinion_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        text=findViewById(R.id.opinion_editext);
        phone=findViewById(R.id.opinion_phone);
        number=findViewById(R.id.opinion_number);
        text.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                int i=s.length();
                number.setText(String.valueOf(i));
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });

        button=findViewById(R.id.opinion_button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(text.getText().equals("")){
                    Toast.makeText(Fm4_Opinion.this,"建议为空",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
